﻿using UnityEngine;
using System.Collections;

public class MainMenuCameraScript : MonoBehaviour
{
    [SerializeField]
    private float rotationSpeed = 10.0f;

    [SerializeField]
    private Texture2D EmptyProgressBar;
    [SerializeField]
    private Texture2D FullProgressBar;

    private AsyncOperation async = null;

    // Update is called once per frame
    void Update()
    {
        transform.Rotate(Vector3.up, rotationSpeed * Time.deltaTime);
    }

    private IEnumerator LoadMainScene()
    {
        async = Application.LoadLevelAsync("main");
        yield return async;
    }

    private void OnGUI()
    {
        if (async != null)
        {
            Debug.Log(async.progress);
            GUI.DrawTexture(new Rect(0, 0, 100, 50), EmptyProgressBar);
            GUI.DrawTexture(new Rect(0, 0, 100 * async.progress, 50), FullProgressBar);
        }       
    }

}
